package com.fm.service;

/**
 * Created by Administrator on 2018/7/30 0030.
 */

import com.fm.entity.User;
import com.fm.mapper.UserMapper;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

import java.util.NoSuchElementException;

@Service
public class UserService extends MBaseService<User, Integer, UserMapper>{

    public User getByUserName(String userName) {
        User user = new User();
        user.setUserName(userName);
        try{
            User reUser = getMyBatisDao().findOne(Example.of(user)).get();
            return reUser;
        }catch (NoSuchElementException e){
            return null;
        }
    }
}
